﻿using UnityEngine;
using System.Collections;

public class jf : MonoBehaviour
{
	int fs, lj, temp;
	string lxts;
	GameObject t1, t2;

	// Use this for initialization
	void Start ()
	{
		t1 = GameObject.Find ("score_t");
		t2 = GameObject.Find ("ts_t");
	}
	
	// Update is called once per frame
	void Update ()
	{
	
	}


	void OnTriggerEnter (Collider other)
	{		
		fs = fs + 100;
		lj++;

		if (lj >= 3 && lj <= 5) {
			lxts = "恭喜！你已经连续扔进" + lj.ToString () + "个小球了";
		} else if (lj > 5) {
			lxts = "太牛了！连续扔进" + lj.ToString () + "个小球";
		}
	
		other.transform.GetComponent<Collider> ().enabled = false;
		other.transform.GetComponent<Rigidbody> ().isKinematic = true;

		t1.transform.GetComponent<TextMesh> ().text = "得分:" + fs;
		t2.transform.GetComponent<TextMesh> ().text = lxts;

		Destroy (other.gameObject, 1);



	}


	void isfill ()
	{
		lj = 0;
		//print ("is fill");
	}



}
